#include "Ctemplate.h"

using namespace std;
using std::char_traits;

const string templateHeader = "\
\
#ifdef __has_include\n\
    #if __has_include(\"lvgl.h\")\n\
        #ifndef LV_LVGL_H_INCLUDE_SIMPLE\n\
            #define LV_LVGL_H_INCLUDE_SIMPLE\n\
        #endif\n\
    #endif\n\
#endif\n\
\n\
#if defined(LV_LVGL_H_INCLUDE_SIMPLE)\n\
    #include \"lvgl.h\"\n\
#else\n\
    #include \"lvgl/lvgl.h\"\n\
#endif\n\n\n\
\
";


const string templateDefine = "\
\
#ifndef LV_ATTRIBUTE_MEM_ALIGN\n\
#define LV_ATTRIBUTE_MEM_ALIGN\n\
#endif\n\n\n\
\
";


const string templateMapStart = "\
\
const LV_ATTRIBUTE_MEM_ALIGN LV_ATTRIBUTE_LARGE_CONST uint8_t %s[] = {\n\
\
";

const string templateMapData8BitStart = "\
\
#if LV_COLOR_DEPTH == 1 || LV_COLOR_DEPTH == 8\n\
\
";

const string templateMapData16BitStart = "\
\
#if LV_COLOR_DEPTH == 16 && LV_COLOR_16_SWAP == 0\n\
\
";

const string templateMapData16BitSwapStart = "\
\
#if LV_COLOR_DEPTH == 16 && LV_COLOR_16_SWAP != 0\n\
\
";

const string templateMapData32BitStart = "\
\
#if LV_COLOR_DEPTH == 32\n\
\
";

const string templateMapDataEnd = "\
\
#endif\n\
\
";

const string templateMapEnd = "\
\
\n};\n\n\n\
\
";


const string templateIMGDsc = "\
\
const lv_img_dsc_t %s = {\n\
  .header.cf = %s,\n\
  .header.always_zero = %d,\n\
  .header.reserved = %d,\n\
  .header.w = %d,\n\
  .header.h = %d,\n\
  .data_size = %d * %s,\n\
  .data = %s,\n\
};\n\n\n\
\
";


map<int, string> imgTrueColorCfgMap = {
    {0, "LV_IMG_CF_TRUE_COLOR"},
    {1, "LV_IMG_CF_TRUE_COLOR_ALPHA"},
    {2, "LV_IMG_CF_TRUE_COLOR_CHROMA_KEYED"},
};

map<int, uint8_t>imgTrueColorCfgMapUint8 = {
    {0, 0x04},
    {1, 0x05},
    {2, 0x06},
};


const string alphaByte = "LV_IMG_PX_SIZE_ALPHA_BYTE";

const string pixelByte = "LV_COLOR_SIZE / 8";

